package com.neusoft.my12306.utils;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.neusoft.my12306.common.res.CommonResult;
import com.neusoft.my12306.service.ISysinfoRolesRService;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.MalformedJwtException;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

public class AuthPathFilter implements Filter {

    private ISysinfoRolesRService service;

    public void setService(ISysinfoRolesRService service) {
        this.service = service;
    }

    @Override
    public void doFilter(ServletRequest req, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest) req;
        String roleid =  request.getHeader("roleid");
        String path = request.getRequestURI();
        boolean b =  service.pass( roleid,path );


        System.out.println(roleid);
        chain.doFilter(request,response);
    }
}
